package jp.co.redfox.archclub.poker.hand;

import java.util.HashSet;
import java.util.Set;

import jp.co.redfox.archclub.poker.Card;

public class Pair {

    private final Set<Card> twoofcards;
    private final String num;
    private Pair(Card card1,Card card2){
     twoofcards = new HashSet<>();
     twoofcards.add(card1);
     twoofcards.add(card2);
     num = card1.getNumber();
    }
    public static Pair createPair(Card card1,Card card2){
     if(card1.isJoker() && card2.isJoker())
       return null;
     else if(card1.isJoker())
       return new Pair(card2, card1);
     else if(card2.isJoker())
       return new Pair(card2, card1);
     else if(card1.sameNumber(card2))
       return new Pair(card1, card2);
     else
         return null;
    }
    public String getNumber(){
     return num;
    }
   
}